/*
 * @Description: Car
 * 
 * @Author: rendc
 * 
 * @Date: 2025-07-29 14:21:32
 * 
 * @LastEditors: rendc
 * 
 * @LastEditTime: 2025-07-29 14:37:31
 */

public class Car {
  // 成员属性 - 封装 - 私有化属性
  private String color;
  private String brand;
  private double price;

  // 成员方法 - 功能 - 行为
  // 车辆前进
  public void forward() {
    System.out.println("车辆前进");
  }

  // 车辆后退
  public void backOff() {
    System.out.println("车辆后退");
  }

  // 车辆转弯
  public void turn(String type) {
    if (type == "Left") {
      System.out.println("车辆左转");
      return;
    }
    if (type == "Right") {
      System.out.println("车辆右转");
      return;
    }
    System.out.println("车辆转弯：" + type);
  }

  // show
  public void show() {
    System.out.println("汽车颜色：" + color + "，品牌：" + brand + "，价格：" + price + "。");
  }

  // get、set方法
  public void setBrand(String brand) {
    this.brand = brand;
  }

  public void setColor(String color) {
    this.color = color;
  }

  public void setPrice(double price) {
    this.price = price;
  }

  public String getBrand() {
    return brand;
  }

  public String getColor() {
    return color;
  }

  public double getPrice() {
    return price;
  }

  // 无参构造器
  public Car() {
    System.out.println("无参构造器");
  }

  // 单参构造器
  public Car(String color) {
    this(color, null, 0.0);
    System.out.println("单参构造器");
  }

  // 全参构造器
  public Car(String color, String brand, double price) {
    System.out.println("全参构造器");
    this.color = color;
    this.brand = brand;
    this.price = price;
  }
}